package com.example.mapp;

import com.example.entity.CustomReport;
import com.example.entity.SpotCheckPlan;
import com.example.entity.SpotObjectPlan;
import com.example.mapp.buildSql.CustomReportMappSql;
import com.example.mapp.buildSql.SpotCheckPlanMappSql;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * 维保人员抽查计划
 */
@Mapper
public interface SpotCheckPlanMapp {

    //通过id查询SQL语句
    @SelectProvider(type = SpotCheckPlanMappSql.class,method = "findlists")
    public List<SpotCheckPlan> findList(SpotCheckPlan spotCheckPlan) throws Exception;

    // 新增数据
    @Insert(" insert into spot_check_plan (plan_name,company,plan_start_time,plan_end_time,create_by,create_date,del_flag,is_check,is_send_message,party_id)" +
            "value " +
            "(#{planName},#{company},#{planStartTime},#{planEndTime},#{createBy},#{createDate},#{delFlag},#{isCheck},#{isSendMessage},#{partyId})")
    public void insert(SpotCheckPlan spotCheckPlan) throws Exception;

    // 修改数据
    @Update("update spot_check_plan set plan_name=#{planName},company=#{company},"+
            " update_by=#{updateBy},update_date=#{updateDate} where id=#{id}")
    public void update(SpotCheckPlan spotCheckPlan) throws Exception;

    // 修改isCheck数据
    @Update("update spot_check_plan set is_check=#{isCheck} where id=#{id}")
    public void updateIsCheck(SpotCheckPlan spotCheckPlan) throws Exception;

    // 修改isSendMessage数据
    @Update("update spot_check_plan set is_send_message='Y' where id=#{id}")
    public void updateIsSendMessage(String id) throws Exception;

    // 删除数据
    @Update("update spot_check_plan set del_flag='0' where id=#{id}")
    public void delete(String id) throws Exception;

}
